<?php
namespace App\Http\Controllers;
use BaiduBce\Services\Bos\BosOptions;
use Illuminate\Http\Request;
use Ramsey\Uuid\Uuid;
use ZeonWang\BaiduBosClient\BosInterface;

/**
 * Created by PhpStorm.
 * User: xinghuo
 * Date: 2017/7/23
 * Time: 下午9:55
 */

class JssdkController{
    use \App\TraitHelper\RequestHelper;

    public function index(Request $request){
        $url = $request->input('url');
        $jssdk = new \JSSDK(config('wechat.app_id'), config("wechat.secret"));
        $signPackage = $jssdk->GetSignPackage($url);
        return $this->formatJson(true,$signPackage);
    }
    public function go(Request $request){
        $uriInfo = str_replace('?','&',$_SERVER['REQUEST_URI']);
        parse_str($uriInfo, $query);
        $_ig = $query['_ig'];
        $url = $request->get('url');
        if ($url) {
            return redirect('http://water.phpyiqiwan.com/#/?ig=' . $_ig);
        }
    }

}